class Book < ActiveRecord::Base

  has_many  :rentals
  has_many  :comments
  has_friendly_id :title, :use_slug => true,
                  :approximate_ascii => true,
                  :max_length => 50,
                  :sequence_separator => "_"
  
  def self.find_books_available
    find(:all, :order => "title")
  end

  validates_uniqueness_of :title
  validates_presence_of :title, :author, :publisher, :first_edition_year, :copy_year, :category, :quantity
  validates_numericality_of :first_edition_year, :copy_year, :quantity

end
